#!/bin/bash

logFile="toplog"

while true
do
    # 获取当前时间
    currentTime=$(date +"%Y-%m-%d %H:%M:%S.%3N")
    echo "------------------- $currentTime -------------------" | tee -a $logFile
    top -n 1 | tee -a $logFile
    sleep 0.1
done
